package java;

import java.sql.Connection;
import java.sql.DriverManager;

//对数据库连接的类
public class ConnectionManager {
    private static final String DRIVER_CLASS="com.mysql.jdbc.Driver";//数据注册
    private static final String url="jdbc:mysql://localhost:3306/libaray?useSSL=FALSE&serverTimezone=UTC";
    private static final String user="root";
    private static final String password="123456789";
    public static Connection getConnection()
    {
        Connection dbConnection=null;
        try

        {
            Class.forName(DRIVER_CLASS);
            dbConnection= DriverManager.getConnection(url,user,password);
        }catch(Exception e)
        {e.printStackTrace();}
        return dbConnection;
    }
}
